Skip to content

Instantly share code, notes, and snippets.

@ronal2do
Last active July 1, 2019 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ronal2do/fdc7c7c30fe376c018167f1d2bbc043a to your computer and use it in GitHub Desktop.
Save ronal2do/fdc7c7c30fe376c018167f1d2bbc043a to your computer and use it in GitHub Desktop.
export class App extends React.PureComponent {
render() {
return (
<View style={{width: '100%', height: '100%'}}>
<OtherComponent />
<SpecialComponent ref={(ref) => ComponentHelper.setReference(ref)}/>
</View>
)
}
}
// ...
export class OtherComponent extends React.PureComponent {
render() {
return (
<TouchableOpacity onPress={() => ComponentHelper.show(300)}/>
)
}
}
// ...
export class ComponentHelper {
static _comp;
static setReference(element) {
this._comp = element;
}
static show() {
return this._comp.show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment