April 2017
Intermediate to advanced
414 pages
8h 14m
English
Since Android text fields normally do not contain a border, I used some conditional logic with the Platform API to remove it:
// Expenses/app/components/EnterBudget/index.js
...
import {
Platform,
...
} from 'react-native';
...
export default class EnterBudget extends Component {
...
render () {
...
return (
<View style={ styles.enterBudgetContainer }>
...
<TextInput
style={ Platform.OS === 'ios' ? styles.textInput :
styles.androidTextInput }
...
/>
...
</View>
)
}
...
}
The styling for the TextInput component in the render method of EnterBudget now checks to see whether the user's operating system is iOS or Android. If it is iOS, it keeps the original textInput style from before; if it is Android, it sets it ...
Read now
Unlock full access