Question: Using Jquery How can I select an option by either its value or text in 1 statement?

```
<select>
   <option value="0">One</option>
   <option value="1">Two</option>
</select>

```

I can do these 2 statements individually but how can I combine the following 2 statements into 1 select OR statement?

```
$('select option[text="Two"]'); //This selects by text

$('select option[value="4"]'); //This selects by value

```

Answer: 
Neither `onLayout` or `Dimensions.addEventListener` worked for us in React 16.3.

Here's a flexbox hack which made the image resize on change of orientation. (We also used React's nice but poorly documented ImageBackground component to get text on top of the image):

```
      <View style={styles.container}>
        <View style={styles.imageRowWithResizeHack}>
          <ImageBackground
            style={styles.imageContainer}
            imageStyle={styles.thumbnailImg}
            source={{ uri: thumbnailUrl }}
          >
            <View style={styles.imageText}>
              <Text style={styles.partnerName}>{partnerName}</Text>
              <Text style={styles.title}>{title.toUpperCase()}</Text>
            </View>
          </ImageBackground>
          <View style={styles.imageHeight} />
        </View>
      </View>

const styles = StyleSheet.create({
  container: {
    position: 'relative',
    flex: 1
  },
  imageRowWithResizeHack: {
    flex: 1,
    flexDirection: 'row'
  },
  imageContainer: {
    flex: 1
  },
  imageHeight: {
    height: 200
  },
  thumbnailImg: {
    resizeMode: 'cover'
  },
  imageText: {
    position: 'absolute',
    top: 30,
    left: TEXT_PADDING_LEFT
  },
  partnerName: {
    fontWeight: '800',
    fontSize: 20,
    color: PARTNER_NAME_COLOR
  },
  title: {
    color: COLOR_PRIMARY_TEXT,
    fontSize: 90,
    fontWeight: '700',
    marginTop: 10,
    marginBottom: 20
  },
});

```

The `imageHeight` style will set the height of the View component (which is invisible to the user), and Flexbox will then automatically flex the image on the same row to be of the same height. So you're basically setting the height of the image in an indirect manner. Flex will ensure it flexes to fill the entire container on orientation change.
Appart from the answer given by user `Rajan Twanabashu` you can also use the [react-native-styleman](https://github.com/anubhavgupta/react-native-styleman) library to handle orientation change very easily: 

Here is an example of how you would do that:

```js
import { withStyles } from 'react-native-styleman';

const styles = () => ({       
    container: {
        // your common styles here for container node.
        flex: 1,
        // lets write a media query to change background color automatically based on the device's orientation 
        '@media': [
          {
             orientation: 'landscape', // for landscape
             styles: {                 // apply following styles
                // these styles would be applied when the device is in landscape 
                // mode.
                 backgroundColor: 'green'
                 //.... more landscape related styles here...
             }
          },
          {
             orientation: 'portrait', // for portrait
             styles: {                // apply folllowing styles
                // these styles would be applied when the device is in portrait 
                // mode.
                 backgroundColor: 'red'
                 //.... more protrait related styles here...
             }
          }
        ]
    }
});

let Component = ({ styles })=>(
    <View style={styles.container}>
        <Text>Some Text</Text>
    </View>
);

// use `withStyles` Higher order Component.
Component = withStyles(styles)(Component);

export {
  Component
};

```