0

I got a problem rendering variable 'html'. I think its because trying to render it before loading ends( error said the variable 'html' is undefined).

is there any modules or something ? (like loading indicator)

return (
<View style={styles.container}>
  <ScrollView style={styles.scrollview}>
    {lecture_render(get_all_list(html))}
  </ScrollView>
</View>

)

I rendered like this, but I want some filter for 'html' variable before render.

1 Answer 1

1

You can simply use an ActivityIndicator component from react-native to render a circular loading indicator if your state has been not been set.

import {ActivityIndicator} from 'react-native'
if (html=== "") {
  return (
    <View>
      <ActivityIndicator />
    </View>
  );
}

return (
  <View style={styles.container}>
    <ScrollView style={styles.scrollview}>
      {lecture_render(get_all_list(html))}
    </ScrollView>
  </View>
);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.