Skip to content
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

[JSS] [React Native] Update packages, fix issues #624

Merged
merged 15 commits into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from 8 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
19 changes: 19 additions & 0 deletions docs/data/routes/release-notes/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ title: Release Notes
---
# Release Notes

## Sitecore JSS 16.1 for Sitecore 10

### Breaking changes
* [PR #624](https://github.com/Sitecore/jss/pull/624) [sitecore-jss-react-native] Removed `dataConversation`, since `editable` property not used in `disconnected` mode.
ambrauer marked this conversation as resolved.
Show resolved Hide resolved

### New Features & Improvements
* [PR #624](https://github.com/Sitecore/jss/pull/624):
* [React-Native sample] Added shared `<Layout/>` component in order to have shared navigation panel.
* [React-Native sample] Sitecore logo in header is touchable and will navigate to Home page when click on it.
* [React-Native sample] Removed usage of `dataConversation`.

### Bug Fixes

* [PR #624](https://github.com/Sitecore/jss/pull/624):
* [sitecore-jss-react-native] [Image] Pass Object `style` type for `SvgUrI` instead of Array.
* [sitecore-jss-react-native] [Date] Always render `<HtmlView/>` if `editable` is provided.
* [React-Native sample] Styleguide-FieldUsage-Date is not working in connected mode.
* [React-Native sample] Styleguide-FieldUsage-Image fix incorrect `src` prop type.

## Sitecore JSS 16.0 for Sitecore 10

### Upgrading
Expand Down
30 changes: 15 additions & 15 deletions packages/sitecore-jss-react-native/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/sitecore-jss-react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@sitecore-jss/sitecore-jss": "^16.1.0-canary.5",
"prop-types": "^15.7.2",
"react-native-htmlview": "^0.15.0",
"react-native-svg": "^9.13.2",
"react-native-svg": "^12.1.0",
"react-native-svg-uri": "^1.2.3"
},
"peerDependencies": {
Expand Down
7 changes: 4 additions & 3 deletions packages/sitecore-jss-react-native/src/components/Date.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export const DateField: React.FunctionComponent<DateFieldProps> = ({
return null;
}

if (field.editable && editable) {
return <HtmlView value={field.editable} {...otherProps} />;
}

let children;

if (render) {
Expand All @@ -37,9 +41,6 @@ export const DateField: React.FunctionComponent<DateFieldProps> = ({
children = field.value as string;
}

if (field.editable && editable) {
return <HtmlView value={children as string} {...otherProps} />;
}
return render ? <>{children}</> : <Text>{children}</Text>;
};

Expand Down
18 changes: 13 additions & 5 deletions packages/sitecore-jss-react-native/src/components/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface ImageFieldValue {
src?: string | number;
width?: number;
height?: number;
style?: unknown;
style?: { [key: string]: unknown };
}

export interface ImageField {
Expand Down Expand Up @@ -46,7 +46,7 @@ const getImageAttrs = (
src?: string | number;
width?: number | undefined;
height?: number | undefined;
style?: unknown;
style?: { [key: string]: unknown };
},
imageUrlParams?: { [paramName: string]: string } | null
) => {
Expand All @@ -67,9 +67,6 @@ const getImageAttrs = (
imgStyles.height = typeof height !== 'number' ? Number(height) : height;
}

// react native styles/StyleSheets can be merged by passing them as an array to the native Image component
newAttrs.style = style ? [imgStyles, style] : imgStyles;

// in react-native, you need to "import" static assets via `require` statements
// when the packager builds your app, it (presumably) statically analyzes your code, extracts
// the assets that are `require`d into an array/map, then assigns them a numerical value.
Expand All @@ -83,6 +80,17 @@ const getImageAttrs = (
newAttrs.source = { uri };
}

if (isSvgImage(newAttrs.source as ImageSourcePropType)) {
// svg image accepts object
newAttrs.style = {
...(style || {}),
...imgStyles,
};
} else {
// react native styles/StyleSheets can be merged by passing them as an array to the native Image component
newAttrs.style = style ? [imgStyles, style] : imgStyles;
}

return newAttrs;
};

Expand Down
154 changes: 0 additions & 154 deletions packages/sitecore-jss-react-native/src/dataConversion.test.ts

This file was deleted.

Loading