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: update Portable Text dependencies #27

Merged
merged 3 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
33 changes: 14 additions & 19 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"author": "Sanity.io <[email protected]>",
"license": "MIT",
"dependencies": {
"@portabletext/react": "1",
"@portabletext/types": "1"
"@portabletext/react": "^3.0.2",
"@portabletext/types": "^2.0.2"
},
"release": {
"branches": [
Expand Down
9 changes: 5 additions & 4 deletions src/react-native-portable-text.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import React from 'react'
import type {PortableTextProps} from '@portabletext/react'
import type {TypedObject, PortableTextBlock} from '@portabletext/types'
import {PortableText as BasePortableText, PortableTextComponentsProvider} from '@portabletext/react'
import {PortableText as BasePortableText, mergeComponents} from '@portabletext/react'
import {defaultComponents} from './components/defaults'

export function PortableText<B extends TypedObject = PortableTextBlock>(
props: Omit<PortableTextProps<B>, 'listNestingMode'>
) {
return (
<PortableTextComponentsProvider components={defaultComponents}>
<BasePortableText {...props} />
</PortableTextComponentsProvider>
<BasePortableText
{...props}
components={mergeComponents(defaultComponents, props.components ?? {})}
/>
)
}
54 changes: 27 additions & 27 deletions test/__snapshots__/runthrough.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ exports[`never mutates input: basicNumberedList 1`] = `
}
}
>
2
1
.
</Text>
<Text
Expand Down Expand Up @@ -548,7 +548,7 @@ exports[`never mutates input: basicNumberedList 1`] = `
}
}
>
2
3
.
</Text>
<Text
Expand Down Expand Up @@ -844,7 +844,7 @@ exports[`never mutates input: deepWeirdLists 1`] = `
}
}
>
2
1
.
</Text>
<Text
Expand Down Expand Up @@ -918,7 +918,7 @@ exports[`never mutates input: deepWeirdLists 1`] = `
}
}
>
2
1
.
</Text>
<Text
Expand Down Expand Up @@ -985,7 +985,7 @@ exports[`never mutates input: deepWeirdLists 1`] = `
}
}
>
2
3
.
</Text>
<Text
Expand Down Expand Up @@ -1398,7 +1398,7 @@ exports[`never mutates input: deepWeirdLists 1`] = `
}
}
>
5
1
.
</Text>
<Text
Expand Down Expand Up @@ -1440,7 +1440,7 @@ exports[`never mutates input: deepWeirdLists 1`] = `
}
}
>
2
1
.
</Text>
<Text
Expand Down Expand Up @@ -1857,7 +1857,7 @@ exports[`never mutates input: listIssue 1`] = `
}
}
>
3
1
.
</Text>
<Text
Expand Down Expand Up @@ -1889,7 +1889,7 @@ exports[`never mutates input: listIssue 1`] = `
}
}
>
3
2
.
</Text>
<Text
Expand Down Expand Up @@ -1953,7 +1953,7 @@ exports[`never mutates input: listIssue 1`] = `
}
}
>
3
4
.
</Text>
<Text
Expand Down Expand Up @@ -1985,7 +1985,7 @@ exports[`never mutates input: listIssue 1`] = `
}
}
>
3
5
.
</Text>
<Text
Expand Down Expand Up @@ -2017,7 +2017,7 @@ exports[`never mutates input: listIssue 1`] = `
}
}
>
3
6
.
</Text>
<Text
Expand Down Expand Up @@ -2049,7 +2049,7 @@ exports[`never mutates input: listIssue 1`] = `
}
}
>
3
7
.
</Text>
<Text
Expand Down Expand Up @@ -2081,7 +2081,7 @@ exports[`never mutates input: listIssue 1`] = `
}
}
>
3
8
.
</Text>
<Text
Expand Down Expand Up @@ -2113,7 +2113,7 @@ exports[`never mutates input: listIssue 1`] = `
}
}
>
3
9
.
</Text>
<Text
Expand Down Expand Up @@ -2145,7 +2145,7 @@ exports[`never mutates input: listIssue 1`] = `
}
}
>
3
10
.
</Text>
<Text
Expand Down Expand Up @@ -3746,7 +3746,7 @@ exports[`never mutates input: listIssue 1`] = `
}
}
>
32
1
.
</Text>
<Text
Expand Down Expand Up @@ -3778,7 +3778,7 @@ exports[`never mutates input: listIssue 1`] = `
}
}
>
32
2
.
</Text>
<Text
Expand Down Expand Up @@ -3810,7 +3810,7 @@ exports[`never mutates input: listIssue 1`] = `
}
}
>
32
3
.
</Text>
<Text
Expand Down Expand Up @@ -3842,7 +3842,7 @@ exports[`never mutates input: listIssue 1`] = `
}
}
>
32
4
.
</Text>
<Text
Expand Down Expand Up @@ -3874,7 +3874,7 @@ exports[`never mutates input: listIssue 1`] = `
}
}
>
32
5
.
</Text>
<Text
Expand Down Expand Up @@ -5007,7 +5007,7 @@ exports[`never mutates input: nestedLists 1`] = `
}
}
>
2
1
.
</Text>
<Text
Expand Down Expand Up @@ -5049,7 +5049,7 @@ exports[`never mutates input: nestedLists 1`] = `
}
}
>
2
1
.
</Text>
<Text
Expand Down Expand Up @@ -5116,7 +5116,7 @@ exports[`never mutates input: nestedLists 1`] = `
}
}
>
2
3
.
</Text>
<Text
Expand Down Expand Up @@ -5226,7 +5226,7 @@ exports[`never mutates input: nestedLists 1`] = `
}
}
>
3
1
.
</Text>
<Text
Expand Down Expand Up @@ -5258,7 +5258,7 @@ exports[`never mutates input: nestedLists 1`] = `
}
}
>
3
2
.
</Text>
<Text
Expand Down Expand Up @@ -5300,7 +5300,7 @@ exports[`never mutates input: nestedLists 1`] = `
}
}
>
2
1
.
</Text>
<Text
Expand Down