Skip to content

Instantly share code, notes, and snippets.

@kirandash
Last active March 3, 2020 10:11
Show Gist options
  • Save kirandash/f24ddbf17735a9b3378b65bf882e8bec to your computer and use it in GitHub Desktop.
Save kirandash/f24ddbf17735a9b3378b65bf882e8bec to your computer and use it in GitHub Desktop.
// 1. Track API calls in network for React Native Application
// Add the below code to App.js file:
XMLHttpRequest = GLOBAL.originalXMLHttpRequest ?
GLOBAL.originalXMLHttpRequest : GLOBAL.XMLHttpRequest;
// 2. React Native Vertically aligning Content
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
}
// 3. onChangeText event not working for TextInput
// It happens bcoz event handler function for onChangeText is asynchronous, hence you should use async/await
<TextInput
onChangeText={text => this.onChange(text)}
/>
onChange = async (text) => {
await this.setState({
listingId: text
})
}
// 4. Clear xcode simulator cache
xcrun simctl erase all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment