Last active
July 1, 2019 12:29
-
-
Save ronal2do/fdc7c7c30fe376c018167f1d2bbc043a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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