Skip to content

Assets add exports for web usage #3552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions demo/src/screens/__tests__/__snapshots__/AvatarScreen.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,7 @@ exports[`AvatarScreen renders screen 1`] = `
}
style={
[
false,
undefined,
undefined,
{
Expand Down Expand Up @@ -1194,6 +1195,7 @@ exports[`AvatarScreen renders screen 1`] = `
}
style={
[
false,
undefined,
undefined,
{
Expand Down Expand Up @@ -1465,6 +1467,7 @@ exports[`AvatarScreen renders screen 1`] = `
}
style={
[
false,
undefined,
undefined,
{
Expand Down Expand Up @@ -1659,6 +1662,7 @@ exports[`AvatarScreen renders screen 1`] = `
}
style={
[
false,
undefined,
undefined,
{
Expand Down Expand Up @@ -1916,6 +1920,7 @@ exports[`AvatarScreen renders screen 1`] = `
}
style={
[
false,
undefined,
undefined,
{
Expand Down Expand Up @@ -2046,6 +2051,7 @@ exports[`AvatarScreen renders screen 1`] = `
}
style={
[
false,
null,
undefined,
undefined,
Expand Down Expand Up @@ -2218,6 +2224,7 @@ exports[`AvatarScreen renders screen 1`] = `
}
style={
[
false,
undefined,
undefined,
{
Expand Down Expand Up @@ -2448,6 +2455,7 @@ exports[`AvatarScreen renders screen 1`] = `
}
style={
[
false,
undefined,
undefined,
{
Expand Down Expand Up @@ -2678,6 +2686,7 @@ exports[`AvatarScreen renders screen 1`] = `
}
style={
[
false,
undefined,
undefined,
{
Expand Down Expand Up @@ -2866,6 +2875,7 @@ exports[`AvatarScreen renders screen 1`] = `
}
style={
[
false,
undefined,
undefined,
{
Expand Down
27 changes: 27 additions & 0 deletions src/assets/icons/index.web.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
console.log(`inside index.web.js`);
export const icons = {
get check() {
return {uri: require('./check.png'), dimensions: {width: 24, height: 24}};
},
get checkSmall() {
return {uri: require('./check-small.png'), dimensions: {width: 24, height: 24}};
},
get minusSmall() {
return {uri: require('./minusSmall.png'), dimensions: {width: 24, height: 24}};
},
get plusSmall() {
return {uri: require('./plusSmall.png'), dimensions: {width: 24, height: 24}};
},
get search() {
return {uri: require('./search.png'), dimensions: {width: 24, height: 24}};
},
get x() {
return {uri: require('./x.png'), dimensions: {width: 24, height: 24}};
},
get xMedium() {
return {uri: require('./xMedium.png'), dimensions: {width: 24, height: 24}};
},
get xFlat() {
return {uri: require('./xFlat.png'), dimensions: {width: 24, height: 24}};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about the size for all of these assets, for example xFlat has 16 in private

}
};
5 changes: 5 additions & 0 deletions src/assets/images/index.web.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const images = {
get gradient() {
return {uri: require('./gradient.png'), dimensions: {width: 56, height: 2}};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't look like.

}
};
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ exports[`Hint Screen component test Different positions and scenarios center pos
}
style={
[
false,
{
"tintColor": "#5A48F5",
},
Expand Down Expand Up @@ -518,6 +519,7 @@ exports[`Hint Screen component test Different positions and scenarios center pos
}
style={
[
false,
{
"tintColor": "#5A48F5",
},
Expand Down Expand Up @@ -797,6 +799,7 @@ exports[`Hint Screen component test Different positions and scenarios left posit
}
style={
[
false,
{
"tintColor": "#5A48F5",
},
Expand Down Expand Up @@ -1075,6 +1078,7 @@ exports[`Hint Screen component test Different positions and scenarios left posit
}
style={
[
false,
{
"tintColor": "#5A48F5",
},
Expand Down Expand Up @@ -1354,6 +1358,7 @@ exports[`Hint Screen component test Different positions and scenarios right posi
}
style={
[
false,
{
"tintColor": "#5A48F5",
},
Expand Down Expand Up @@ -1632,6 +1637,7 @@ exports[`Hint Screen component test Different positions and scenarios right posi
}
style={
[
false,
{
"tintColor": "#5A48F5",
},
Expand Down
1 change: 1 addition & 0 deletions src/components/image/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ class Image extends PureComponent<Props, State> {
// @ts-ignore
<ImageView
style={[
Constants.isWeb && source?.dimensions,
tintColor && {tintColor},
shouldFlipRTL && styles.rtlFlipped,
width && {width},
Expand Down