3

First I tried to load image with following code and it does load the image

render(){
return(
  <View style={{backgroundColor:'red', flex:1, alignItems:'center'}}>
    <Text> Landing Page controller</Text>
    <Image
    source={require('./symbol.png')}
  />
  </View>
);  }

enter image description here Now i have load lots of image through out the application from different files. In such case it is very difficult to maintain the code and resources. That's why I created the separate file

resource.js

 module.export= {
                symbol:require('./symbol.png'),
              };

and then in component file I tried to load like below.

import JResource from './resource.js';
   .....................
   ..................
 render(){
        return(
          <View style={{backgroundColor:'red', flex:1, alignItems:'center'}}>
            <Text> Landing Page controller</Text>
            <Image
            source={JResource.symbol}
          />
          </View>
        );
      }

Now the application did run , but no image is displayed. It would be great if any body would figure out what's wrong here.

enter image description here

1 Answer 1

1

you should module.exports = ..... not export

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.