type fixes

This commit is contained in:
Hailey
2024-12-01 17:38:07 -08:00
parent 04ccdd8540
commit 1831167aac
11 changed files with 63 additions and 40 deletions
-1
View File
@@ -234,7 +234,6 @@ module.exports = function (config) {
compileSdkVersion: 34,
targetSdkVersion: 34,
buildToolsVersion: '34.0.0',
kotlinVersion: '1.8.0',
newArchEnabled: false,
},
},
+1 -1
View File
@@ -180,7 +180,7 @@
"react-native-pager-view": "6.6.0",
"react-native-picker-select": "^9.3.1",
"react-native-progress": "bluesky-social/react-native-progress",
"react-native-qrcode-styled": "^0.3.2",
"react-native-qrcode-styled": "^0.3.3",
"react-native-reanimated": "^3.16.3",
"react-native-root-siblings": "^4.1.1",
"react-native-safe-area-context": "4.14.0",
+1
View File
@@ -64,6 +64,7 @@ export const atoms = {
* Used for the outermost components on screens, to ensure that they can fill
* the screen and extend beyond.
*/
// @ts-ignore - web only minHeight string
util_screen_outer: [
web({
minHeight: '100vh',
+41 -30
View File
@@ -405,37 +405,47 @@ export const Button = React.forwardRef<View, ButtonProps>(
}
}, [t, variant, color, size, shape, disabled])
const {gradientColors, gradientHoverColors, gradientLocations} =
React.useMemo(() => {
const colors: string[] = []
const hoverColors: string[] = []
const locations: number[] = []
const gradient = {
primary: tokens.gradients.sky,
secondary: tokens.gradients.sky,
secondary_inverted: tokens.gradients.sky,
negative: tokens.gradients.sky,
gradient_primary: tokens.gradients.primary,
gradient_sky: tokens.gradients.sky,
gradient_midnight: tokens.gradients.midnight,
gradient_sunrise: tokens.gradients.sunrise,
gradient_sunset: tokens.gradients.sunset,
gradient_nordic: tokens.gradients.nordic,
gradient_bonfire: tokens.gradients.bonfire,
}[color || 'primary']
const gradientValues = React.useMemo(() => {
const gradient = {
primary: tokens.gradients.sky,
secondary: tokens.gradients.sky,
secondary_inverted: tokens.gradients.sky,
negative: tokens.gradients.sky,
gradient_primary: tokens.gradients.primary,
gradient_sky: tokens.gradients.sky,
gradient_midnight: tokens.gradients.midnight,
gradient_sunrise: tokens.gradients.sunrise,
gradient_sunset: tokens.gradients.sunset,
gradient_nordic: tokens.gradients.nordic,
gradient_bonfire: tokens.gradients.bonfire,
}[color || 'primary']
if (variant === 'gradient') {
colors.push(...gradient.values.map(([_, color]) => color))
hoverColors.push(...gradient.values.map(_ => gradient.hover_value))
locations.push(...gradient.values.map(([location, _]) => location))
if (variant === 'gradient') {
if (gradient.values.length < 2) {
throw new Error(
'Gradient buttons must have at least two colors in the gradient',
)
}
return {
gradientColors: colors,
gradientHoverColors: hoverColors,
gradientLocations: locations,
colors: gradient.values.map(([_, color]) => color) as [
string,
string,
...string[],
],
hoverColors: gradient.values.map(_ => gradient.hover_value) as [
string,
string,
...string[],
],
locations: gradient.values.map(([location, _]) => location) as [
number,
number,
...number[],
],
}
}, [variant, color])
}
}, [variant, color])
const context = React.useMemo<ButtonContext>(
() => ({
@@ -458,6 +468,7 @@ export const Button = React.forwardRef<View, ButtonProps>(
// @ts-ignore - this will always be a pressable
ref={ref}
aria-label={label}
aria-pressed={state.pressed}
accessibilityLabel={label}
disabled={disabled || false}
accessibilityState={{
@@ -478,7 +489,7 @@ export const Button = React.forwardRef<View, ButtonProps>(
onHoverOut={onHoverOut}
onFocus={onFocus}
onBlur={onBlur}>
{variant === 'gradient' && (
{variant === 'gradient' && gradientValues && (
<View
style={[
a.absolute,
@@ -489,10 +500,10 @@ export const Button = React.forwardRef<View, ButtonProps>(
<LinearGradient
colors={
state.hovered || state.pressed
? gradientHoverColors
: gradientColors
? gradientValues.hoverColors
: gradientValues.colors
}
locations={gradientLocations}
locations={gradientValues.locations}
start={{x: 0, y: 0}}
end={{x: 1, y: 1}}
style={[a.absolute, a.inset_0]}
+8 -2
View File
@@ -14,10 +14,16 @@ export function GradientFill({
| typeof tokens.gradients.summer
| typeof tokens.gradients.nordic
}) {
if (gradient.values.length < 2) {
throw new Error('Gradient must have at least 2 colors')
}
return (
<LinearGradient
colors={gradient.values.map(c => c[1])}
locations={gradient.values.map(c => c[0])}
colors={gradient.values.map(c => c[1]) as [string, string, ...string[]]}
locations={
gradient.values.map(c => c[0]) as [number, number, ...number[]]
}
start={{x: 0, y: 0}}
end={{x: 1, y: 1}}
style={[a.absolute, a.inset_0]}
+5 -1
View File
@@ -13,7 +13,11 @@ export function LinearGradientBackground({
}) {
const gradient = gradients.sky.values.map(([_, color]) => {
return color
})
}) as [string, string, ...string[]]
if (gradient.length < 2) {
throw new Error('Gradient must have at least 2 colors')
}
return (
<LinearGradient colors={gradient} style={style}>
+1
View File
@@ -1,5 +1,6 @@
import React from 'react'
import {View} from 'react-native'
// @ts-expect-error missing types
import QRCode from 'react-native-qrcode-styled'
import type ViewShot from 'react-native-view-shot'
import {AppBskyGraphDefs, AppBskyGraphStarterpack} from '@atproto/api'
+3 -3
View File
@@ -124,7 +124,7 @@ type GalleryItemProps = {
image: ComposerImage
altTextControlStyle?: ViewStyle
imageControlsStyle?: ViewStyle
imageStyle?: ViewStyle
imageStyle?: ImageStyle
onChange: (next: ComposerImage) => void
onRemove: () => void
}
@@ -160,7 +160,7 @@ const GalleryItem = ({
return (
<View
style={imageStyle}
style={imageStyle as ViewStyle}
// Fixes ALT and icons appearing with half opacity when the post is inactive
renderToHardwareTextureAndroid>
<TouchableOpacity
@@ -221,7 +221,7 @@ const GalleryItem = ({
<Image
testID="selectedPhotoImage"
style={[styles.image, imageStyle] as ImageStyle}
style={[styles.image, imageStyle]}
source={{
uri: (image.transformed ?? image.source).path,
}}
+1
View File
@@ -31,6 +31,7 @@ export type ButtonType =
// Augment type for react-native-web (see https://github.com/necolas/react-native-web/issues/1684#issuecomment-766451866)
declare module 'react-native' {
interface PressableStateCallbackType {
// @ts-ignore web only
hovered?: boolean
focused?: boolean
}
+1 -1
View File
@@ -87,7 +87,7 @@ export function DropdownButton({
}: PropsWithChildren<DropdownButtonProps>) {
const {_} = useLingui()
const ref1 = useRef<TouchableOpacity>(null)
const ref1 = useRef<View>(null)
const ref2 = useRef<View>(null)
const onPress = (e: GestureResponderEvent) => {
+1 -1
View File
@@ -16109,7 +16109,7 @@ react-native-progress@bluesky-social/react-native-progress:
dependencies:
prop-types "^15.7.2"
react-native-qrcode-styled@^0.3.2:
react-native-qrcode-styled@^0.3.3:
version "0.3.3"
resolved "https://registry.yarnpkg.com/react-native-qrcode-styled/-/react-native-qrcode-styled-0.3.3.tgz#552b7fb85f8e570524ad3e89b4c0b4a8a82e0b67"
integrity sha512-DjxFhFAJBY3y2FEBbWSpwtPaSjsEc5RutTHejxzfRNuyTzg1f5thplGyON8yx0kbi6h0h+57s8cH4aSFGj1mQg==