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

feat: use codegenNativeComponent to import native views #1847

Merged
merged 89 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
e1fccf2
feat: use codegenNativeComponent to import native views
WoLewicki Aug 23, 2022
ad47bc6
fix: satisfy typescript
WoLewicki Aug 23, 2022
8f2d958
Merge branch 'main' into @wolewicki/use-cnc
WoLewicki Aug 26, 2022
5668008
feat: make fabric specs TS
WoLewicki Aug 26, 2022
a51a928
make ts happy
WoLewicki Aug 26, 2022
cac2e9b
feat: transfer circle
WoLewicki Aug 26, 2022
2887a29
fix: minor change
WoLewicki Aug 26, 2022
782f30e
feat: bump types to have codegen types
WoLewicki Aug 29, 2022
6f04124
feat: transfer rest of elements
WoLewicki Aug 29, 2022
8709923
fix: wrong import
WoLewicki Aug 29, 2022
80fe687
feat: try to add babel plugin
WoLewicki Aug 29, 2022
bcb2bc8
feat: remove ts ignore
WoLewicki Aug 30, 2022
761b29d
feat: add missing props in ClipPath and Defs
WoLewicki Aug 30, 2022
6d0d89a
feat: align clipPath and defs on iOS
WoLewicki Aug 30, 2022
04cb78e
feat: remove redundant foreignObject method
WoLewicki Aug 30, 2022
e624edf
feat: remove redundant image props
WoLewicki Aug 30, 2022
5d4af81
feat: remove redundant props in all components
WoLewicki Aug 30, 2022
57131b2
feat: apply imagesource changes
WoLewicki Aug 30, 2022
2cbd9d5
feat: update VMs on paper
WoLewicki Aug 31, 2022
5246a33
feat: change src to RCTImageSource on iOS
WoLewicki Aug 31, 2022
4092d83
fix: remove redundant fabric src
WoLewicki Aug 31, 2022
c0a5fb6
feat: add proper colors to svgView
WoLewicki Aug 31, 2022
a588f59
feat: remove redundant props in Text and TSpan
WoLewicki Aug 31, 2022
0364418
fix: change group props type to interface
WoLewicki Aug 31, 2022
d83ae51
feat: add SvgTextCommonProps interface
WoLewicki Aug 31, 2022
8f8d2e3
feat: add needed changes to text components
WoLewicki Aug 31, 2022
d573095
feat: update interfaces
WoLewicki Aug 31, 2022
a2ccd5e
Merge branch 'main' into @wolewicki/use-cnc
WoLewicki Aug 31, 2022
0c9f726
chore: bump Podfile.locks
WoLewicki Aug 31, 2022
10411d7
chore: bump plugin version
WoLewicki Sep 1, 2022
58d7fa1
feat: add first look at requested changes
WoLewicki Sep 1, 2022
0ecb6ed
feat: move android modules to turbomodules
WoLewicki Sep 2, 2022
c7d1f05
feat: try add ios turbomodules
WoLewicki Sep 2, 2022
d782a24
feat: abstract modules from components and remove bridge code
WoLewicki Sep 5, 2022
e441614
fix: make example compile on ios
WoLewicki Sep 5, 2022
76635e3
fix: use correct queue depending on the bridge
WoLewicki Sep 5, 2022
d93a712
fix: make android compile on paper
WoLewicki Sep 5, 2022
2d99ce3
fix: remove jest so ci passes
WoLewicki Sep 5, 2022
70dfff0
chore: merge current main
WoLewicki Sep 6, 2022
2a32483
fix: make ts happy
WoLewicki Sep 6, 2022
c97c124
fix: make method async and remove call to uiManagerQueue
WoLewicki Sep 7, 2022
56ca966
feat: add custom state for image loading on ios
WoLewicki Sep 12, 2022
2f5f438
fix: remove props from module
WoLewicki Sep 12, 2022
5bc0b55
chore: merge current main
WoLewicki Sep 14, 2022
2bc3752
feat: add first look at autolinking custom descriptor
WoLewicki Sep 16, 2022
326e277
fix: correct javaPackageName
WoLewicki Sep 16, 2022
6e686d4
fix: update yarn.lock and fix RNSVGImageState.h
WoLewicki Sep 16, 2022
94ce2b5
feat: make custom descriptor on Android compile
WoLewicki Sep 16, 2022
35d32af
fix: add JSI_EXPORT, fix ios pointer events and simplify impl on Android
WoLewicki Sep 19, 2022
cbe70fa
fix: add jsi header
WoLewicki Sep 19, 2022
93aa492
Merge branch 'main' into @wolewicki/use-cnc
WoLewicki Sep 21, 2022
02233eb
feat: add pointer events to specs
WoLewicki Sep 21, 2022
471d687
feat: move delegate methods higher
WoLewicki Sep 21, 2022
08700fd
feat: update paper delegates and interfaces
WoLewicki Sep 21, 2022
685b3c5
Merge branch 'main' into @wolewicki/use-cnc
WoLewicki Sep 22, 2022
4751773
feat: remove unused file and empty fabric folder from build.gradle
WoLewicki Sep 22, 2022
ac2da14
feat: add common folder to files
WoLewicki Sep 22, 2022
562b366
fix: restore transform parsing on android and remove commented code
WoLewicki Sep 22, 2022
4338406
fix: wrong formatting and unnecessary folders in spotless
WoLewicki Sep 22, 2022
2a824cb
Merge branch 'main' into @wolewicki/use-cnc
WoLewicki Sep 27, 2022
aa103c2
feat: inline require turbomodules and add enforcing
WoLewicki Sep 27, 2022
dcd9200
fix: localsvg types
WoLewicki Sep 27, 2022
66a986f
feat: add RuntimeException when svgView is null
WoLewicki Sep 30, 2022
3b6d853
feat: add method for Fabric and call super updateProps so Animated wo…
WoLewicki Oct 5, 2022
f799306
chore: merge current main
WoLewicki Oct 5, 2022
7ef48f8
fix: add common folder to formatter
WoLewicki Oct 7, 2022
c8c4b9a
feat: apply proposed changes
WoLewicki Oct 7, 2022
7f403b0
feat: start adding props needed by validator to SvgView
WoLewicki Oct 7, 2022
ed30933
feat: remove alert on mount
WoLewicki Oct 10, 2022
9892495
feat: add react-native.config.js to npm files
WoLewicki Oct 11, 2022
230dea6
feat: split SvgView spec to iOS and Android
WoLewicki Oct 11, 2022
28dc589
fix: update view managers on paper Android
WoLewicki Oct 11, 2022
8e88102
feat: add implementation with excludePlatform
WoLewicki Oct 11, 2022
4b4c14c
feat: change name for android to trick codegen
WoLewicki Oct 11, 2022
094dd34
feat: update specs on paper
WoLewicki Oct 11, 2022
2754b2f
fix: revert App.tsx update
WoLewicki Oct 11, 2022
f3881ff
fix: problems with refs and types
WoLewicki Oct 12, 2022
59ab9af
feat: make changes needed for older versions of RN
WoLewicki Oct 12, 2022
1cde687
feat: add implementation with suffixed props
WoLewicki Oct 12, 2022
393286f
feat: push recommended android svgView props change
WoLewicki Oct 17, 2022
4de589c
feat: update paper delegates and interfaces
WoLewicki Oct 17, 2022
3564ba5
fix: call setBorderRadius instead
WoLewicki Oct 18, 2022
c763a8e
feat: bump RN version
WoLewicki Oct 25, 2022
fb1335d
chore: merge current main
WoLewicki Oct 25, 2022
ebde726
chore: bump RN version to 0.70.4
WoLewicki Oct 26, 2022
19bcb24
fix: make image descriptor be taken intto consideration on Fabric and…
WoLewicki Oct 28, 2022
5394bbb
fix: dont pass transform prop to G child in SvgView
WoLewicki Oct 28, 2022
57fa255
Merge branch 'main' into @wolewicki/use-cnc
WoLewicki Nov 2, 2022
fd6d779
fix: strict version of RN
WoLewicki Nov 2, 2022
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
25 changes: 10 additions & 15 deletions android/src/main/java/com/horcrux/svg/SvgViewManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,32 +315,27 @@ public void setNextFocusLeft(SvgView view, int value) {
}

@Override
@ReactProp(name = "borderBottomLeftRadiusAndroid")
public void setBorderBottomLeftRadiusAndroid(SvgView view, float value) {
super.setBorderBottomLeftRadius(view, value);
public void setBorderRadius(SvgView view, double value) {
super.setBorderRadius(view, 0, (float) value);
}

@Override
@ReactProp(name = "borderBottomRightRadiusAndroid")
public void setBorderBottomRightRadiusAndroid(SvgView view, float value) {
super.setBorderBottomRightRadius(view, value);
public void setBorderTopLeftRadius(SvgView view, double value) {
super.setBorderTopLeftRadius(view, (float) value);
WoLewicki marked this conversation as resolved.
Show resolved Hide resolved
}

@Override
@ReactProp(name = "borderRadiusAndroid")
public void setBorderRadiusAndroid(SvgView view, float value) {
super.setBorderRadius(view, value);
public void setBorderTopRightRadius(SvgView view, double value) {
super.setBorderTopRightRadius(view, (float) value);
}

@Override
@ReactProp(name = "borderTopRightRadiusAndroid")
public void setBorderTopRightRadiusAndroid(SvgView view, float value) {
super.setBorderTopRightRadius(view, value);
public void setBorderBottomRightRadius(SvgView view, double value) {
super.setBorderBottomRightRadius(view, (float) value);
}

@Override
@ReactProp(name = "borderTopLeftRadiusAndroid")
public void setBorderTopLeftRadiusAndroid(SvgView view, float value) {
super.setBorderTopLeftRadius(view, value);
public void setBorderBottomLeftRadius(SvgView view, double value) {
super.setBorderBottomLeftRadius(view, (float) value);
}
}
9 changes: 0 additions & 9 deletions src/elements/Svg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,6 @@ export default class Svg extends Shape<SvgProps> {
props.onLayout = onLayout;
}

// This is needed for tricking codegen, see `AndroidSvgViewNativeComponent.ts` for more info.
if (Platform.OS === 'android') {
props.borderTopRightRadiusAndroid = props.borderTopRightRadius;
props.borderBottomRightRadiusAndroid = props.borderBottomRightRadius;
props.borderRadiusAndroid = props.borderRadius;
props.borderBottomLeftRadiusAndroid = props.borderBottomLeftRadius;
props.borderTopLeftRadiusAndroid = props.borderTopLeftRadius;
}

const RNSVGSvg = Platform.OS === 'android' ? RNSVGSvgAndroid : RNSVGSvgIOS;

return (
Expand Down
20 changes: 12 additions & 8 deletions src/fabric/AndroidSvgViewNativeComponent.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
import type { ColorValue } from 'react-native';
import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
import type {
Double,
Float,
Int32,
} from 'react-native/Libraries/Types/CodegenTypes';
import type { ViewProps } from './utils';

type NativeBackgroundProp = Readonly<{
Expand Down Expand Up @@ -59,13 +63,13 @@ interface NativeProps extends ViewProps {
nextFocusLeft?: Int32;
// TODO: those props are present in the `ReactPropGroup` but are not supported
// (https://github.com/facebook/react-native/blob/35556dba600fbb28e0f41340a74b6c4a59bc6018/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java#L613)
// and static view config validator says that they are missing. We then add additionals setters for those props with `Android` suffix
// and set them to the values of the original ones in `Svg.tsx`. We also call proper setters on the native side for them.
borderTopRightRadiusAndroid?: Float;
borderBottomRightRadiusAndroid?: Float;
borderRadiusAndroid?: Float;
borderBottomLeftRadiusAndroid?: Float;
borderTopLeftRadiusAndroid?: Float;
// and static view config validator says that they are missing.
// We pass them as doubles although they should be floats, and cast them to floats again on the native side.
borderTopRightRadius?: Double;
borderBottomRightRadius?: Double;
borderRadius?: Double;
borderBottomLeftRadius?: Double;
borderTopLeftRadius?: Double;
}

export default codegenNativeComponent<NativeProps>('RNSVGSvgViewAndroid', {
Expand Down