I made lots of comments on Map.js, so that others can understand work on the component too
Store Player.js now has hardcoded initial state.
I cleaned unnecessary codes on Map.js
I removed player marker .png files and made a .js containing links to my dropbox (we can change this to firebase upload if speed becomes an issue). I spent more than 2 hours working on this issue.
So, in order to render each player marker by mapping through each player object, for example,
source: {require: (../assets/${player.team}Player${index}.png)
will not work.
I made lots of comments on Map.js, so that others can understand work on the component too
Store Player.js now has hardcoded initial state.
I cleaned unnecessary codes on Map.js
I removed player marker .png files and made a .js containing links to my dropbox (we can change this to firebase upload if speed becomes an issue). I spent more than 2 hours working on this issue.
Long story short, react-native doesn't support dynamic string path to image source. Read: https://github.com/facebook/react-native/issues/2481
So, in order to render each player marker by mapping through each player object, for example, source: {require: (
../assets/${player.team}Player${index}.png
) will not work.Therefore, I formatted playerMarketPath as:
const playerMarkerPath = [ redPlayer1, bluePlayer1, redPlayer2, bluePlayer2, redPlayer3, bluePlayer3, redPlayer4, bluePlayer4 ];
This is a dumb way, but since we are going to set each player team alternatively, this could work..