Skip to content
Open
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
118 changes: 118 additions & 0 deletions .maestro/enrichedInput/flows/custom_style_colors_visual.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
appId: swmansion.enriched.example
---
# Validates custom colors on plain text, inline styles, and paragraph styles.
- launchApp

- tapOn:
id: 'toggle-screen-button'

- tapOn:
id: 'editor-input'

# Section 1: Plain text with colors

- tapOn:
id: 'toolbar-text-color'
- tapOn:
id: 'color-swatch-FF0000'
- inputText: 'Red text'
- tapOn:
id: 'toolbar-text-color'
- tapOn:
id: 'color-swatch-clear'
- inputText: ' '

- tapOn:
id: 'toolbar-bg-color'
- tapOn:
id: 'color-swatch-FFFF00'
- inputText: 'Yellow back'
- tapOn:
id: 'toolbar-bg-color'
- tapOn:
id: 'color-swatch-clear'
- inputText: ' '

- tapOn:
id: 'toolbar-text-color'
- tapOn:
id: 'color-swatch-FF0000'
- tapOn:
id: 'toolbar-bg-color'
- tapOn:
id: 'color-swatch-FFFF00'
- inputText: 'Red+Yellow'
- tapOn:
id: 'toolbar-text-color'
- tapOn:
id: 'color-swatch-clear'
- tapOn:
id: 'toolbar-bg-color'
- tapOn:
id: 'color-swatch-clear'
- inputText: ' '

# Section 2: Inline styles + color

- tapOn:
id: 'toolbar-bold'
- tapOn:
id: 'toolbar-text-color'
- tapOn:
id: 'color-swatch-FF0000'
- inputText: 'Bold red'
- tapOn:
id: 'toolbar-bold'
- tapOn:
id: 'toolbar-text-color'
- tapOn:
id: 'color-swatch-clear'
- inputText: ' '

- tapOn:
id: 'toolbar-italic'
- tapOn:
id: 'toolbar-bg-color'
- tapOn:
id: 'color-swatch-FFFF00'
- inputText: 'Italic yellow back'
- tapOn:
id: 'toolbar-italic'
- tapOn:
id: 'toolbar-bg-color'
- tapOn:
id: 'color-swatch-clear'
- inputText: ' '
- pressKey: Enter

# Section 3: Paragraph styles + color

- tapOn:
id: 'toolbar-heading-5'
- tapOn:
id: 'toolbar-text-color'
- tapOn:
id: 'color-swatch-FF0000'
- inputText: 'H5 red'
- pressKey: Enter
- tapOn:
id: 'toolbar-text-color'
- tapOn:
id: 'color-swatch-clear'

- tapOn:
id: 'toolbar-quote'
- tapOn:
id: 'toolbar-bg-color'
- tapOn:
id: 'color-swatch-FFFF00'
- inputText: 'Quote yellow back'
- tapOn:
id: 'toolbar-bg-color'
- tapOn:
id: 'color-swatch-clear'

- runFlow:
file: '../subflows/capture_or_assert_screenshot.yaml'
env:
SCREENSHOT_NAME: 'custom_style_colors'
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions .maestro/enrichedText/flows/custom_style_colors_visual.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
appId: swmansion.enriched.example
---
# Validates that custom style colors are displayed correctly
- launchApp

- tapOn:
id: 'toggle-screen-button'

- tapOn:
id: 'toggle-enriched-text-screen-button'

- runFlow:
file: '../subflows/set_enriched_text_value.yaml'
env:
VALUE: >
<html>
<p><span style="color: #FF5733;">Standard 6-digit Hex text</span></p>
<p><span style="background-color: #000000; color: #FFFFFF;">White text on black background</span></p>
<p><span style="background-color: #00FF0040;">25% transparent green background</span></p>
<p><span style="color: #0000FF80;">50% transparent blue text</span></p>
<p><span style="color: #F00;">Red 3-digit shorthand text</span></p>
<h6><span style="background-color: #0F0; color: #000;">Black text on green</span></h6>
</html>

- runFlow:
file: '../subflows/capture_or_assert_screenshot.yaml'
env:
SCREENSHOT_NAME: 'custom_style_colors_visual'
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,13 @@ class EnrichedTextInputViewManager :
view?.setTextAlignment(alignment)
}

override fun setStyle(
view: EnrichedTextInputView?,
styleJSON: String,
) {
// TODO: Implement
}
Comment thread
kacperzolkiewski marked this conversation as resolved.

override fun measure(
context: Context,
localData: ReadableMap?,
Expand Down
8 changes: 4 additions & 4 deletions apps/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2026,7 +2026,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
FBLazyVector: c00c20551d40126351a6783c47ce75f5b374851b
hermes-engine: 484c595d9e6a0b7b7607e8ead508ba5c472493c7
hermes-engine: b4dad6ba67535bb03c8ff1006b337cba14db16cb
RCTDeprecation: 3bb167081b134461cfeb875ff7ae1945f8635257
RCTRequired: 74839f55d5058a133a0bc4569b0afec750957f64
RCTSwiftUI: 87a316382f3eab4dd13d2a0d0fd2adcce917361a
Expand All @@ -2035,7 +2035,7 @@ SPEC CHECKSUMS:
React: 1b1536b9099195944034e65b1830f463caaa8390
React-callinvoker: 6dff6d17d1d6cc8fdf85468a649bafed473c65f5
React-Core: 39ee05b5798296f433dd3c3624c57a187c1510e3
React-Core-prebuilt: 3ca7a49d919f940e7de8fb0c2a3f5cfcb665f09b
React-Core-prebuilt: 69556f895326f23c007f3a6869340045d7dca106
React-CoreModules: e78bfd2617075bc0e50c689df4a29232bd72ad82
React-cxxreact: 3fe21801d46097cf74c3dff6953677bebc4a3c2a
React-debug: e1f00fcd2cef58a2897471a6d76a4ef5f5f90c74
Expand Down Expand Up @@ -2097,8 +2097,8 @@ SPEC CHECKSUMS:
ReactAppDependencyProvider: 706b65371b90b5cc797b6639e8979f2e5cecd6da
ReactCodegen: ab01ebfffac5cda9140204eb872ed97c15df225f
ReactCommon: 47ef95b0920948a0b54d7439f7452501eeeac071
ReactNativeDependencies: 652705a9bc92800d0b1e15177a61ba70d89d24dd
ReactNativeEnrichedHtml: 93722241410f2daaa8c20ce6bcfcf4666bfd9166
ReactNativeDependencies: 8a208df374583424130645685d86306befc275cf
ReactNativeEnrichedHtml: 7d90df4aced7f533c7bd15ac296879b214413361
Yoga: e83c3121d079541e69f3c5c623faaaf933fb5812

PODFILE CHECKSUM: 88c10840d02e9884b2dc3f457d5120f83ac3803b
Expand Down
92 changes: 92 additions & 0 deletions apps/example/src/components/ColorPickerRow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { type FC } from 'react';
import { Pressable, ScrollView, StyleSheet, Text } from 'react-native';

interface Props {
colors: string[];
activeColor: string;
onSelectColor: (color: string) => void;
onClear: () => void;
}

export const ColorPickerRow: FC<Props> = ({
colors,
activeColor,
onSelectColor,
onClear,
}) => {
return (
<ScrollView
horizontal
showsHorizontalScrollIndicator={false}
style={styles.container}
contentContainerStyle={styles.content}
>
<Pressable
testID="color-swatch-clear"
style={styles.clearButton}
onPress={onClear}
>
<Text style={styles.clearText}>✕</Text>
</Pressable>
{colors.map((color) => {
const isActive = color.toLowerCase() === activeColor?.toLowerCase();
const swatchId = `color-swatch-${color.replace('#', '').toUpperCase()}`;
return (
<Pressable
key={color}
testID={swatchId}
onPress={() => onSelectColor(color)}
style={[
styles.swatch,
{ backgroundColor: color },
isActive && styles.swatchActive,
color === '#FFFFFF' && styles.swatchBordered,
]}
/>
);
})}
</ScrollView>
);
};

const SWATCH_SIZE = 28;

const styles = StyleSheet.create({
container: {
width: '100%',
backgroundColor: 'rgba(0, 26, 114, 0.9)',
},
content: {
flexDirection: 'row',
alignItems: 'center',
paddingHorizontal: 8,
paddingVertical: 8,
gap: 8,
},
clearButton: {
width: SWATCH_SIZE,
height: SWATCH_SIZE,
borderRadius: SWATCH_SIZE / 2,
backgroundColor: 'rgba(255,255,255,0.15)',
justifyContent: 'center',
alignItems: 'center',
},
clearText: {
color: 'white',
fontSize: 14,
lineHeight: 16,
},
swatch: {
width: SWATCH_SIZE,
height: SWATCH_SIZE,
borderRadius: SWATCH_SIZE / 2,
},
swatchActive: {
borderWidth: 3,
borderColor: 'white',
},
swatchBordered: {
borderWidth: 1,
borderColor: 'rgba(0,0,0,0.25)',
},
});
Loading