Fix various warnings that show up on Andriod
This commit is contained in:
parent
2335a21266
commit
077a55f4a7
|
@ -56,7 +56,7 @@ const App = (props) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return <MenuProvider style = { providerStyles }>
|
return <MenuProvider customStyles = { providerStyles }>
|
||||||
<AppContainer />
|
<AppContainer />
|
||||||
</MenuProvider>;
|
</MenuProvider>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,8 +16,8 @@ import ModerateMenuJsx from "src/components/moderate-menu.js";
|
||||||
|
|
||||||
const TEST_IMAGE_1 = "https://cache.desktopnexus.com/thumbseg/2255/2255124-bigthumbnail.jpg";
|
const TEST_IMAGE_1 = "https://cache.desktopnexus.com/thumbseg/2255/2255124-bigthumbnail.jpg";
|
||||||
const TEST_IMAGE_2 = "https://natureproducts.net/Forest_Products/Cutflowers/Musella_cut.jpg";
|
const TEST_IMAGE_2 = "https://natureproducts.net/Forest_Products/Cutflowers/Musella_cut.jpg";
|
||||||
const TEST_ACCOUNT_1 = { acct: "njms", display_name: "Nat🔆", avatar: TEST_IMAGE_1 };
|
const TEST_ACCOUNT_1 = { id: 1, acct: "njms", display_name: "Nat🔆", avatar: TEST_IMAGE_1 };
|
||||||
const TEST_ACCOUNT_2 = { acct: "someone", display_name: "Some person", avatar: TEST_IMAGE_2 };
|
const TEST_ACCOUNT_2 = { id: 2, acct: "someone", display_name: "Some person", avatar: TEST_IMAGE_2 };
|
||||||
|
|
||||||
const TEST_STATUS = {
|
const TEST_STATUS = {
|
||||||
id: 1,
|
id: 1,
|
||||||
|
@ -68,42 +68,46 @@ const DirectJsx = ({ navigation }) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderConversation = ({ item }) => {
|
const renderConversation = (item) => {
|
||||||
const boldIfUnread = item.unread ? styles.bold : {};
|
const boldIfUnread = item.unread ? styles.bold : {};
|
||||||
|
|
||||||
return <View style = { [styles.row, styles.conv.container] }>
|
return (
|
||||||
<TouchableOpacity
|
<View
|
||||||
style = { [styles.row, styles.conv.containerButton] }
|
style = { [styles.row, styles.conv.container] }
|
||||||
onPress = {
|
key = { item.id }>
|
||||||
onPressConversationFactory(item)
|
<TouchableOpacity
|
||||||
}>
|
style = { [styles.row, styles.conv.containerButton] }
|
||||||
<View style = { styles.conv.avatar.container }>
|
onPress = {
|
||||||
<Image
|
onPressConversationFactory(item)
|
||||||
source = { { uri: item.accounts[0].avatar } }
|
}>
|
||||||
style = { styles.conv.avatar.image }/>
|
<View style = { styles.conv.avatar.container }>
|
||||||
|
<Image
|
||||||
|
source = { { uri: item.accounts[0].avatar } }
|
||||||
|
style = { styles.conv.avatar.image }/>
|
||||||
|
</View>
|
||||||
|
<View style = { styles.conv.body }>
|
||||||
|
<Text style = { boldIfUnread }>
|
||||||
|
{ item.accounts.map(account => account.acct).join(", ") }
|
||||||
|
</Text>
|
||||||
|
<Text style = { boldIfUnread }>
|
||||||
|
{
|
||||||
|
// Prefix message with acct
|
||||||
|
[
|
||||||
|
item.accounts.length > 1 ?
|
||||||
|
item.last_status.account.acct + ": "
|
||||||
|
: "",
|
||||||
|
item.last_status.content,
|
||||||
|
].join("")
|
||||||
|
}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
</TouchableOpacity>
|
||||||
|
<View style = { styles.conv.context }>
|
||||||
|
<ModerateMenuJsx
|
||||||
|
triggerStyle = { styles.menu.trigger } />
|
||||||
</View>
|
</View>
|
||||||
<View style = { styles.conv.body }>
|
|
||||||
<Text style = { boldIfUnread }>
|
|
||||||
{ item.accounts.map(account => account.acct).join(", ") }
|
|
||||||
</Text>
|
|
||||||
<Text style = { boldIfUnread }>
|
|
||||||
{
|
|
||||||
// Prefix message with acct
|
|
||||||
[
|
|
||||||
item.accounts.length > 1 ?
|
|
||||||
item.last_status.account.acct + ": "
|
|
||||||
: "",
|
|
||||||
item.last_status.content,
|
|
||||||
].join("")
|
|
||||||
}
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
</TouchableOpacity>
|
|
||||||
<View style = { styles.conv.context }>
|
|
||||||
<ModerateMenuJsx
|
|
||||||
triggerStyle = { styles.menu.trigger } />
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -129,10 +133,10 @@ const DirectJsx = ({ navigation }) => {
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
{ state.loaded ?
|
{ state.loaded ?
|
||||||
<FlatList
|
filterConversations(
|
||||||
data = { filterConversations(state.conversations, state.query) }
|
state.conversations,
|
||||||
renderItem = { renderConversation }
|
state.query
|
||||||
keyExtractor = { conv => conv.id }/>
|
).map(renderConversation)
|
||||||
: <></>
|
: <></>
|
||||||
}
|
}
|
||||||
</ScreenWithTrayJsx>
|
</ScreenWithTrayJsx>
|
||||||
|
|
|
@ -4,7 +4,6 @@ import {
|
||||||
Text,
|
Text,
|
||||||
Image,
|
Image,
|
||||||
TextInput,
|
TextInput,
|
||||||
FlatList,
|
|
||||||
ScrollView,
|
ScrollView,
|
||||||
Dimensions,
|
Dimensions,
|
||||||
TouchableOpacity,
|
TouchableOpacity,
|
||||||
|
@ -30,8 +29,8 @@ import { timeToAge } from "src/interface/rendering";
|
||||||
|
|
||||||
const TEST_IMAGE_1 = "https://cache.desktopnexus.com/thumbseg/2255/2255124-bigthumbnail.jpg";
|
const TEST_IMAGE_1 = "https://cache.desktopnexus.com/thumbseg/2255/2255124-bigthumbnail.jpg";
|
||||||
const TEST_IMAGE_2 = "https://natureproducts.net/Forest_Products/Cutflowers/Musella_cut.jpg";
|
const TEST_IMAGE_2 = "https://natureproducts.net/Forest_Products/Cutflowers/Musella_cut.jpg";
|
||||||
const TEST_ACCOUNT_1 = { acct: "someone", display_name: "Someone", avatar: TEST_IMAGE_1 };
|
const TEST_ACCOUNT_1 = { id: 1, acct: "someone", display_name: "Someone", avatar: TEST_IMAGE_1 };
|
||||||
const TEST_ACCOUNT_2 = { acct: "someone_else", display_name: "Another person", avatar: TEST_IMAGE_2 };
|
const TEST_ACCOUNT_2 = { id: 2, acct: "someone_else", display_name: "Another person", avatar: TEST_IMAGE_2 };
|
||||||
|
|
||||||
const TEST_STATUS = {
|
const TEST_STATUS = {
|
||||||
account: TEST_ACCOUNT_1,
|
account: TEST_ACCOUNT_1,
|
||||||
|
@ -168,7 +167,7 @@ const ConversationJsx = ({ navigation }) => {
|
||||||
<MenuOptions customStyles = { accountListOptionsStyles }>
|
<MenuOptions customStyles = { accountListOptionsStyles }>
|
||||||
{
|
{
|
||||||
conversation.accounts.map(account =>
|
conversation.accounts.map(account =>
|
||||||
<MenuOption>
|
<MenuOption key = { account.id }>
|
||||||
<Image
|
<Image
|
||||||
source = { { uri: account.avatar } }
|
source = { { uri: account.avatar } }
|
||||||
style = { styles.backBar.accountList.avatar }/>
|
style = { styles.backBar.accountList.avatar }/>
|
||||||
|
@ -188,9 +187,9 @@ const ConversationJsx = ({ navigation }) => {
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|
||||||
const renderMessage = ({ item }) => {
|
const renderMessage = (item) => {
|
||||||
const yours = state.profile.acct == item.account.acct;
|
const yours = state.profile.acct == item.account.acct;
|
||||||
return <>
|
return <View key = { item.id }>
|
||||||
{ !yours
|
{ !yours
|
||||||
? <Text style = { styles.message.acct }>
|
? <Text style = { styles.message.acct }>
|
||||||
{ item.account.acct }
|
{ item.account.acct }
|
||||||
|
@ -223,7 +222,7 @@ const ConversationJsx = ({ navigation }) => {
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</>;
|
</View>;
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -233,10 +232,7 @@ const ConversationJsx = ({ navigation }) => {
|
||||||
state = { state }
|
state = { state }
|
||||||
setState = { setState }>
|
setState = { setState }>
|
||||||
{ state.loaded
|
{ state.loaded
|
||||||
? <FlatList
|
? state.messages.map(renderMessage)
|
||||||
data = { state.messages }
|
|
||||||
renderItem = { renderMessage }
|
|
||||||
keyExtractor = { item => item.id }/>
|
|
||||||
: <></>
|
: <></>
|
||||||
}
|
}
|
||||||
</ConversationContainerJsx>
|
</ConversationContainerJsx>
|
||||||
|
|
|
@ -10,23 +10,25 @@ const TEST_ACCOUNTS = [
|
||||||
avatar: TEST_IMAGE,
|
avatar: TEST_IMAGE,
|
||||||
username: "njms",
|
username: "njms",
|
||||||
acct: "njms",
|
acct: "njms",
|
||||||
display_name: "Nat🔆"
|
display_name: "Nat🔆",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 2,
|
||||||
avatar: TEST_IMAGE,
|
avatar: TEST_IMAGE,
|
||||||
username: "njms",
|
username: "njms",
|
||||||
acct: "njms",
|
acct: "njms",
|
||||||
display_name: "Nat🔆"
|
display_name: "Nat🔆",
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
const TEST_HASHTAGS = [
|
const TEST_HASHTAGS = [
|
||||||
{
|
{
|
||||||
name: "hashtag1"
|
id: 1,
|
||||||
|
name: "hashtag1",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "hashtag2"
|
id: 2,
|
||||||
|
name: "hashtag2",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -265,7 +265,11 @@ const ProfileDisplayJsx = ({navigation}) => {
|
||||||
style = { styles.fields.row }
|
style = { styles.fields.row }
|
||||||
key = { index }>
|
key = { index }>
|
||||||
<View style = { styles.fields.cell.name }>
|
<View style = { styles.fields.cell.name }>
|
||||||
<Text>{ field.name }</Text>
|
<Text style = {
|
||||||
|
{ textAlign: "center", }
|
||||||
|
}>
|
||||||
|
{ field.name }
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style = { styles.fields.cell.value }>
|
<View style = { styles.fields.cell.value }>
|
||||||
<HTMLLink link = { field.value }/>
|
<HTMLLink link = { field.value }/>
|
||||||
|
@ -341,7 +345,6 @@ const styles = {
|
||||||
cell: {
|
cell: {
|
||||||
name: {
|
name: {
|
||||||
width: screen_width / 3,
|
width: screen_width / 3,
|
||||||
textAlgin: "center",
|
|
||||||
},
|
},
|
||||||
value: {
|
value: {
|
||||||
width: (screen_width / 3) * 2,
|
width: (screen_width / 3) * 2,
|
||||||
|
|
|
@ -202,11 +202,11 @@ const SettingsJsx = (props) => {
|
||||||
style = { styles.fields.plus }
|
style = { styles.fields.plus }
|
||||||
source = { require("assets/eva-icons/plus.png") } />
|
source = { require("assets/eva-icons/plus.png") } />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<TouchableOpacity style = { styles.largeButton }>
|
<TouchableOpacity style = { styles.button.container }>
|
||||||
<Text> Save Profile </Text>
|
<Text style = { styles.button.text }> Save Profile </Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
style = { styles.largeButton }
|
style = { styles.button.container }
|
||||||
onPress = {
|
onPress = {
|
||||||
() => {
|
() => {
|
||||||
AsyncStorage.multiRemove(
|
AsyncStorage.multiRemove(
|
||||||
|
@ -216,7 +216,11 @@ const SettingsJsx = (props) => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}>
|
}>
|
||||||
<Text style = { styles.textWarning }> Log out </Text>
|
<Text style = {
|
||||||
|
[ styles.button.text, styles.button.warning ]
|
||||||
|
}>
|
||||||
|
Log out
|
||||||
|
</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
</ScreenWithBackBarJsx>
|
</ScreenWithBackBarJsx>
|
||||||
|
@ -284,21 +288,23 @@ const styles = {
|
||||||
width: SCREEN_WIDTH / 2.5,
|
width: SCREEN_WIDTH / 2.5,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
largeButton: {
|
button: {
|
||||||
width: SCREEN_WIDTH / 1.2,
|
container: {
|
||||||
padding: 15,
|
width: SCREEN_WIDTH / 1.2,
|
||||||
marginTop: 10,
|
padding: 15,
|
||||||
marginBottom: 5,
|
marginTop: 10,
|
||||||
marginLeft: "auto",
|
marginBottom: 5,
|
||||||
marginRight: "auto",
|
marginLeft: "auto",
|
||||||
borderWidth: 1,
|
marginRight: "auto",
|
||||||
borderColor: "#888",
|
borderWidth: 1,
|
||||||
borderRadius: 5,
|
borderColor: "#888",
|
||||||
textAlign: "center",
|
borderRadius: 5,
|
||||||
},
|
},
|
||||||
textWarning: {
|
text: { textAlign: "center" },
|
||||||
fontWeight: "bold",
|
warning: {
|
||||||
textDecorationLine: "underline",
|
fontWeight: "bold",
|
||||||
|
textDecorationLine: "underline",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import {
|
||||||
View,
|
View,
|
||||||
Image,
|
Image,
|
||||||
Text,
|
Text,
|
||||||
FlatList,
|
|
||||||
Dimensions,
|
Dimensions,
|
||||||
TouchableOpacity,
|
TouchableOpacity,
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
|
@ -42,49 +41,14 @@ const TEST_DATA = [
|
||||||
{...TEST_PROFILE, id: 3},
|
{...TEST_PROFILE, id: 3},
|
||||||
{...TEST_PROFILE, id: 4},
|
{...TEST_PROFILE, id: 4},
|
||||||
{...TEST_PROFILE, id: 5},
|
{...TEST_PROFILE, id: 5},
|
||||||
{...TEST_PROFILE, id: 6}
|
{...TEST_PROFILE, id: 6},
|
||||||
]
|
]
|
||||||
|
|
||||||
function renderItemFactory(navigation) {
|
|
||||||
// Returns a renderItem function with the context of props.navigation so
|
|
||||||
// that it can enable the person to navigate to the selected account.
|
|
||||||
return ({item}) => (
|
|
||||||
<View style = { [ styles.flexContainer, styles.itemContainer ] }>
|
|
||||||
<TouchableOpacity
|
|
||||||
style = { styles.accountButton }
|
|
||||||
onPress = {
|
|
||||||
() => {
|
|
||||||
navigation.navigate("Profile", { acct: item.acct });
|
|
||||||
}
|
|
||||||
}>
|
|
||||||
<View style = { styles.flexContainer }>
|
|
||||||
<Image
|
|
||||||
source = { { uri: item.avatar} }
|
|
||||||
style = { styles.avatar } />
|
|
||||||
<View>
|
|
||||||
<Text style = { styles.acct }>
|
|
||||||
@{ item.acct }
|
|
||||||
</Text>
|
|
||||||
<Text style = { styles.displayName }>
|
|
||||||
{ item.display_name }
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</TouchableOpacity>
|
|
||||||
<ModerateMenuJsx
|
|
||||||
containerStyle = { styles.moderateMenu }
|
|
||||||
triggerStyle = { styles.ellipsis } />
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const UserListJsx = ({navigation}) => {
|
const UserListJsx = ({navigation}) => {
|
||||||
// const data = navigation.getParam("data", [])
|
// const data = navigation.getParam("data", [])
|
||||||
const data = TEST_DATA;
|
const data = TEST_DATA;
|
||||||
const context = navigation.getParam("context", "");
|
const context = navigation.getParam("context", "");
|
||||||
|
|
||||||
const renderItem = renderItemFactory(navigation);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScreenWithBackBarJsx navigation = { navigation }>
|
<ScreenWithBackBarJsx navigation = { navigation }>
|
||||||
{
|
{
|
||||||
|
@ -94,10 +58,38 @@ const UserListJsx = ({navigation}) => {
|
||||||
</Text>
|
</Text>
|
||||||
: <></>
|
: <></>
|
||||||
}
|
}
|
||||||
<FlatList
|
{
|
||||||
data = { data }
|
data.map(item =>
|
||||||
renderItem = { renderItem }
|
<View
|
||||||
keyExtractor = { item => item.id }/>
|
key = { item.id }
|
||||||
|
style = { [ styles.flexContainer, styles.itemContainer ] }>
|
||||||
|
<TouchableOpacity
|
||||||
|
style = { styles.accountButton }
|
||||||
|
onPress = {
|
||||||
|
() => {
|
||||||
|
navigation.navigate("Profile", { acct: item.acct });
|
||||||
|
}
|
||||||
|
}>
|
||||||
|
<View style = { styles.flexContainer }>
|
||||||
|
<Image
|
||||||
|
source = { { uri: item.avatar} }
|
||||||
|
style = { styles.avatar } />
|
||||||
|
<View>
|
||||||
|
<Text style = { styles.acct }>
|
||||||
|
@{ item.acct }
|
||||||
|
</Text>
|
||||||
|
<Text style = { styles.displayName }>
|
||||||
|
{ item.display_name }
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</TouchableOpacity>
|
||||||
|
<ModerateMenuJsx
|
||||||
|
containerStyle = { styles.moderateMenu }
|
||||||
|
triggerStyle = { styles.ellipsis } />
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
</ScreenWithBackBarJsx>
|
</ScreenWithBackBarJsx>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -223,7 +223,7 @@ const ViewCommentsJsx = (props) => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View>
|
<>
|
||||||
{ state.loaded ?
|
{ state.loaded ?
|
||||||
<View style = { { flex: 1 } }>
|
<View style = { { flex: 1 } }>
|
||||||
<BackBarJsx navigation = { props.navigation }/>
|
<BackBarJsx navigation = { props.navigation }/>
|
||||||
|
@ -283,7 +283,7 @@ const ViewCommentsJsx = (props) => {
|
||||||
</View>
|
</View>
|
||||||
: <></>
|
: <></>
|
||||||
}
|
}
|
||||||
</View>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue