Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile Native - Fix toolbar status when pressing buttons on Android (and iOS) #9319

Merged
merged 2 commits into from Aug 24, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions packages/editor/src/components/rich-text/index.native.js
Expand Up @@ -44,6 +44,9 @@ export class RichText extends Component {
}

onActiveFormatsChange( formats ) {
// force re-render the component skipping shouldComponentUpdate() See: https://reactjs.org/docs/react-component.html#forceupdate
// This is needed because our shouldComponentUpdate impl. doesn't take in consideration props yet.
this.forceUpdate();
const newFormats = formats.reduce( ( accFormats, activeFormat ) => {
accFormats[ activeFormat ] = getFormatValue( activeFormat );
return accFormats;
Expand Down Expand Up @@ -82,8 +85,8 @@ export class RichText extends Component {
* Handles any case where the content of the AztecRN instance has changed in size
*/

onContentSizeChange( event ) {
const contentHeight = event.nativeEvent.contentSize.height;
onContentSizeChange( contentSize ) {
const contentHeight = contentSize.height;
this.forceUpdate(); // force re-render the component skipping shouldComponentUpdate() See: https://reactjs.org/docs/react-component.html#forceupdate
this.props.onContentSizeChange( {
aztecHeight: contentHeight,
Expand Down Expand Up @@ -139,7 +142,6 @@ export class RichText extends Component {
const {
tagName,
style,
eventCount,
formattingControls,
formatters,
} = this.props;
Expand All @@ -155,6 +157,7 @@ export class RichText extends Component {

// Save back to HTML from React tree
const html = '<' + tagName + '>' + renderToString( this.props.content.contentTree ) + '</' + tagName + '>';
const eventCount = this.props.content.eventCount;

return (
<View>
Expand Down