React-Native: Flatlist does not render JSON data on mobile with installed apk

Asked

Viewed 46 times

0

Hello I have a problem a little weird... I have an apk generated in release mode with signature everything ok,but when I install in my cell a Xiomi 7 on the home screen does not redenrize the flatlist where I search the data via JSON on an external server... I installed in 3 cell phones where have been used Debugging and not one of them worked being the other Xiome redmiNote 8 e uma Assus... Ai leaves for the weird thing rsrs, installing the APK in other phones the flatlist works searching the data and rendering them as encoded in my index.

Any idea what it is will be welcome...

//
const [filteredDataSource, setFilteredDataSource] = useState([]);//filtrando dados do json
const [listars, setListars] = useState([]);//array do json
const[isLoading, setIsLoading] = useState(false);//reload view 

useEffect(() => {
    setIsLoading(true);
    fetch('http://serverteste:8092/json/')  
    .then((response) => response.json())
    .then((responseJson) => {
      setFilteredDataSource(responseJson);
      setListars(responseJson);
    })
    .catch(() => Alert.alert('Erro ao buscar Acessos'))
    .finally(() => setIsLoading(false));
}, []
);

My flatList

        <View style={styles.container}> 
            {isLoading ? (
              <View style={[styles.containerAcrt, styles.horizontal]}>
                <ActivityIndicator
                      animating = {true}
                      color = '#bc2b78'
                      size = "large"
                      />
                      
              </View>

            ): (
                <FlatList
                data={filteredDataSource}
                keyExtractor={(item, index) => index.toString()}
                renderItem={ItemView}
                />
            )
            }
          </View>
Here is a print of the rendered flatlist
on a clean cell phone never used debugging
or used for development
This is the application screen print on my mobile phone
Aqui esta um print da flatlist renderizada em um celular limpo nunca usado depuração ou usado para desenvolvimento Este é o print da tela do aplicativo em meu celular

Remarks:

  • Regarding server-side permissions has already been checked and this is all ok...
  • The tests done on my mobile phones were in networks different from the local network where the server is hosted so it already rules out any conflict of IP range.
  • when I run application in mode DEBUG works normally.

from already I thank that power gives a light of what can be...

1 answer

1

Your request is HTTP if Android is 10, it has a protection when it generates the build, you have to release this type of request on Androidmanifest.xml Tag application add the property android:usesCleartextTraffic="true"

  • I understand I will configure this, since thank you very much!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.