O'Reilly logo

React Native By Example by Richard Kho

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

EnterBudget styling changes

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required