Question: I'm trying to ask for runtime permission in ReactNative, but I'm always getting a "Permission is null" error in device screen.

here is the code:

```
import React, {Component} from 'react';
import {Text, View, StyleSheet, TextInput, Button} from 'react-native';
import {PermissionsAndroid} from 'react-native';

export default class HomeScreen extends React.Component {

  componentDidMount()
  {
    PermissionsAndroid.request(PermissionsAndroid.READ_PHONE_STATE) 
  }

  render () {
    return (
      <View style={styles.container}>
        <Text style={styles.paragraph}>Seja Bem vindo a BBTS!</Text>
        <Text style={styles.paragraph}>
          Matricula: {this.props.navigation.state.params.matricula}
        </Text>
        <Text style={styles.paragraph}>
          Email: {this.props.navigation.state.params.email}
        </Text>
        <Text style={styles.paragraph}>
            imei vem aqui
        </Text>
      </View>
    );
  }
}

```

I already put this on android manifest. My APi target is 26.

Any ideias?

Solution: 

```
async requestPermission() {
    try {
      const granted = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.READ_PHONE_STATE)

      if (granted === PermissionsAndroid.RESULTS.GRANTED) {
        console.log("You can read the phone state")
      } else {
        console.log("permission denied")
      }
    } catch (err) {
      console.warn(err)
    }
  }

  componentDidMount()
  {
    this.requestPermission();
  }

```

Answer: 
The purpose of these special methods is to give *you*, the designer of your data structure, a way to perform lookups in a fast way that is appropriate to your situation. For example, you could derive a class from `list` that is enhanced by a reverse index for fast lookup by value. (Obviously this would slow down insertion since the index needs to be updated, but let's assume that you'll be doing a lot of lookups so you know it's worth it.)

If your class has no way to improve on the default access, you don't need to define the special methods. Python will fall back on whatever is available, including sequential search.
That's exactly how it works. Here's a demonstration using `list`:

```
$ for a in `seq 6`; do python3 -m timeit -s "a = 10**$a" 'a in list(range(a))'; done
1000000 loops, best of 3: 0.84 usec per loop
100000 loops, best of 3: 3.04 usec per loop
10000 loops, best of 3: 57.7 usec per loop
1000 loops, best of 3: 639 usec per loop
100 loops, best of 3: 6.74 msec per loop
10 loops, best of 3: 70.3 msec per loop

```

You can observe the time complexity increasing proportional to the size of the container.