Skip to content
Merged
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
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This guide assumes you:

- Have read through the [React Native Docs](https://reactnative.dev/docs/getting-started). In particular:
- Understand classes vs function components (we use the latter) and [hooks](https://reactjs.org/docs/hooks-intro.html). Here's a good [video](https://www.youtube.com/watch?v=dpw9EHDh2bM) that explains function components and hooks for traditional OOP developers.
- Understand [Native Modules](https://reactnative.dev/docs/0.74/native-modules-intro).
- Understand [Native Modules](https://reactnative.dev/docs/turbo-native-modules-introduction).
- Have a local fork of FluentUI React Native and have run the test app.

## Understanding the Repository Structure
Expand Down Expand Up @@ -44,7 +44,7 @@ Tokens help us achieve simpler customization for complex higher order components

This section covers creating and adding a new component package to FluentUI React Native's monorepo. If you are instead working on an existing component and adding a native module, skip to the next two sections.

Most components should use the compose framework as it offers the comprehensive set of patterns like tokens and slots, but if you're creating a simple component that doesn't require those patterns, there's a lighter pattern called [stagedComponent](./packages/framework/use-slot/src/stagedComponent.ts). The stagedComponent pattern splits up the render function into two stages. Stage 1 handles building props and hook calls (best to separate the hook calls from the render tree since they rely on call order). Stage 2 returns the actual element tree, any conditional branching should happen here (Icon is a good example of using stagedCompoenent).
Most components should use the compose framework as it offers the comprehensive set of patterns like tokens and slots, but if you're creating a simple component that doesn't require those patterns, there's a lighter pattern called [stagedComponent](./packages/framework-base/src/component-patterns/stagedComponent.ts). The stagedComponent pattern splits up the render function into two stages. Stage 1 handles building props and hook calls (best to separate the hook calls from the render tree since they rely on call order). Stage 2 returns the actual element tree, any conditional branching should happen here (Icon is a good example of using stagedCompoenent).

1. Create a new directory in of these two locations, depending on your component:

Expand Down Expand Up @@ -82,7 +82,7 @@ Reach out to Samuel Freiberg with any questions related to E2E testing.

## Adding native code to your new component

Through the power of [Native Modules](https://reactnative.dev/docs/0.74/native-modules-intro), we are able to create components that are comprised of native platform code, rather than JS. This is particularly useful if you want platform specific behavior, or if you want a component that feels much more aligned to it's specific platform. The downside is you must implement the Native module for every platform you wish to support. It's worth investigating whether you truly need a native module, or if a more cross platform JS implementation is the better approach.
Through the power of [Native Modules](https://reactnative.dev/docs/turbo-native-modules-introduction), we are able to create components that are comprised of native platform code, rather than JS. This is particularly useful if you want platform specific behavior, or if you want a component that feels much more aligned to it's specific platform. The downside is you must implement the Native module for every platform you wish to support. It's worth investigating whether you truly need a native module, or if a more cross platform JS implementation is the better approach.

There are a few caveats to know of adding a native module to a FluentUI React Native component:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "fix dead links in markdown files",
"packageName": "@fluentui-react-native/avatar",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "fix dead links in markdown files",
"packageName": "@fluentui-react-native/badge",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "tighten up typing for framework, fixing the resulting errors",
"packageName": "@fluentui-react-native/button",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "fix dead links in markdown files",
"packageName": "@fluentui-react-native/checkbox",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "fix dead links in markdown files",
"packageName": "@fluentui-react-native/chip",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "tighten up typing for framework, fixing the resulting errors",
"packageName": "@fluentui-react-native/composition",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix use-slot to use new rendering patterns",
"packageName": "@fluentui-react-native/dropdown",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "tighten up typing for framework, fixing the resulting errors",
"packageName": "@fluentui-react-native/experimental-checkbox",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "tighten up typing for framework, fixing the resulting errors",
"packageName": "@fluentui-react-native/experimental-expander",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "tighten up typing for framework, fixing the resulting errors",
"packageName": "@fluentui-react-native/experimental-menu-button",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "update phasedComponent pattern and switch direct stagedComponent callers to use it",
"packageName": "@fluentui-react-native/experimental-shadow",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "fix dead links in markdown files",
"packageName": "@fluentui-react-native/experimental-shimmer",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "update phasedComponent pattern and switch direct stagedComponent callers to use it",
"packageName": "@fluentui-react-native/framework-base",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "update phasedComponent pattern and switch direct stagedComponent callers to use it",
"packageName": "@fluentui-react-native/icon",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "fix dead links in markdown files",
"packageName": "@fluentui-react-native/input",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "fix dead links in markdown files",
"packageName": "@fluentui-react-native/link",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "update phasedComponent pattern and switch direct stagedComponent callers to use it",
"packageName": "@fluentui-react-native/menu",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "update phasedComponent pattern and switch direct stagedComponent callers to use it",
"packageName": "@fluentui-react-native/notification",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "update phasedComponent pattern and switch direct stagedComponent callers to use it",
"packageName": "@fluentui-react-native/overflow",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "fix dead links in markdown files",
"packageName": "@fluentui-react-native/radio-group",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "tighten up typing for framework, fixing the resulting errors",
"packageName": "@fluentui-react-native/switch",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "update phasedComponent pattern and switch direct stagedComponent callers to use it",
"packageName": "@fluentui-react-native/tablist",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "fix dead links in markdown files",
"packageName": "@fluentui-react-native/text",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "update phasedComponent pattern and switch direct stagedComponent callers to use it",
"packageName": "@fluentui-react-native/tooltip",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix use-slot to use new rendering patterns",
"packageName": "@fluentui-react-native/use-slot",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "tighten up typing for framework, fixing the resulting errors",
"packageName": "@fluentui-react-native/use-slots",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "tighten up typing for framework, fixing the resulting errors",
"packageName": "@fluentui-react-native/use-styling",
"email": "[email protected]",
"dependentChangeType": "patch"
}
2 changes: 1 addition & 1 deletion packages/components/Avatar/SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Basic examples:
<Avatar shape="square" avatarColor="purple" name="Richard Feynman" />
```

More examples on the [Test pages for the Avatar](../../../apps/fluent-tester/src/TestComponents/Avatar). Instructions on running the tester app can be found [here](../../../apps/fluent-tester/README.md).
More examples on the [Test pages for the Avatar](../../../apps/tester-core/src/TestComponents/Avatar). Instructions on running the tester app can be found [here](../../../apps/fluent-tester/README.md).

## Variants

Expand Down
2 changes: 1 addition & 1 deletion packages/components/Badge/SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Basic examples:
<PresenceBadge outOfOffice={true} status="away" />
```

More examples on the [Test pages for the Badge](../../../apps/fluent-tester/src/TestComponents/Badge). Instructions on running the tester app can be found [here](../../../apps/fluent-tester/README.md).
More examples on the [Test pages for the Badge](../../../apps/tester-core/src/TestComponents/Badge). Instructions on running the tester app can be found [here](../../../apps/fluent-tester/README.md).

## Visual Examples

Expand Down
2 changes: 1 addition & 1 deletion packages/components/Button/SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Basic examples:
<Button size="large">Text</Button>
```

More examples on the [Test pages for the Button](../../../apps/fluent-tester/src/TestComponents/Button). Instructions on running the tester app can be found [here](../../../apps/fluent-tester/README.md).
More examples on the [Test pages for the Button](../../../apps/tester-core/src/TestComponents/Button). Instructions on running the tester app can be found [here](../../../apps/fluent-tester/README.md).

## Visual Examples

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
/** @jsxImportSource @fluentui-react-native/framework-base */
import { View } from 'react-native';
import { View, type ViewProps } from 'react-native';

import { compose } from '@fluentui-react-native/framework';
import { Icon } from '@fluentui-react-native/icon';
import { TextV1 as Text } from '@fluentui-react-native/text';

import type { CompoundButtonType } from './CompoundButton.types';
import type { CompoundButtonSlotProps, CompoundButtonType } from './CompoundButton.types';
import { compoundButtonName } from './CompoundButton.types';

export const CompoundButton = compose<CompoundButtonType>({
export interface MobileSlotProps extends CompoundButtonSlotProps {
root: ViewProps;
}
export interface CompoundButtonMobileType extends CompoundButtonType {
slotProps: MobileSlotProps;
}

export const CompoundButton = compose<CompoundButtonMobileType>({
displayName: compoundButtonName,
slots: {
root: View,
Expand Down
2 changes: 1 addition & 1 deletion packages/components/Button/src/CompoundButton/SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Basic examples:
<CompoundButton size="small" secondaryContent="A second line">Text</CompoundButton>
```

More examples on the [Test pages for the Button](../../../../../apps/fluent-tester/src/TestComponents/Button). Instructions on running the tester app can be found [here](../../../../../apps/fluent-tester/README.md).
More examples on the [Test pages for the Button](../../../../../apps/tester-core/src/TestComponents/Button). Instructions on running the tester app can be found [here](../../../../../apps/fluent-tester/README.md).

## Visual Examples

Expand Down
2 changes: 1 addition & 1 deletion packages/components/Button/src/FAB/SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const flipFABcontent = React.useCallback(() => setShowFABText(!showFABText), [sh
<FAB showContent={showFABText} onClick={flipFABcontent}>Text</FAB>
```

More examples on the [Test pages for the Button](../../../../../apps/fluent-tester/src/TestComponents/Button). Instructions on running the tester app can be found [here](../../../../../apps/fluent-tester/README.md).
More examples on the [Test pages for the Button](../../../../../apps/tester-core/src/TestComponents/Button). Instructions on running the tester app can be found [here](../../../../../apps/fluent-tester/README.md).

## Visual Examples

Expand Down
2 changes: 1 addition & 1 deletion packages/components/Button/src/ToggleButton/SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Basic examples:
<ToggleButton size="small">Text</ToggleButton>
```

More examples on the [Test pages for the Button](../../../../../apps/fluent-tester/src/TestComponents/Button). Instructions on running the tester app can be found [here](../../../../../apps/fluent-tester/README.md).
More examples on the [Test pages for the Button](../../../../../apps/tester-core/src/TestComponents/Button). Instructions on running the tester app can be found [here](../../../../../apps/fluent-tester/README.md).

## Visual Examples

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
/** @jsxImportSource @fluentui-react-native/framework-base */
import { View } from 'react-native';
import { View, type ViewProps } from 'react-native';

import { compose } from '@fluentui-react-native/framework';
import { Icon } from '@fluentui-react-native/icon';
import { TextV1 as Text } from '@fluentui-react-native/text';

import type { ToggleButtonType } from './ToggleButton.types';
import type { ToggleButtonSlotProps, ToggleButtonType } from './ToggleButton.types';
import { toggleButtonName } from './ToggleButton.types';

export const ToggleButton = compose<ToggleButtonType>({
interface ToggleButtonSlotPropsAndroid extends ToggleButtonSlotProps {
root: ViewProps;
}

interface ToggleButtonAndroidType extends ToggleButtonType {
slotProps: ToggleButtonSlotPropsAndroid;
}

export const ToggleButton = compose<ToggleButtonAndroidType>({
displayName: toggleButtonName,
slots: {
root: View,
Expand Down
2 changes: 1 addition & 1 deletion packages/components/Checkbox/SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Basic examples:
<Checkbox label="Controlled Checkbox" onChange={onChangeFunction} checked={checked} />
```

More examples on the [Test pages for the Checkbox](../../../apps/fluent-tester/src/TestComponents/CheckboxV1). Instructions on running the tester app can be found [here](../../../apps/fluent-tester/README.md).
More examples on the [Test pages for the Checkbox](../../../apps/tester-core/src/TestComponents/CheckboxV1). Instructions on running the tester app can be found [here](../../../apps/fluent-tester/README.md).

## Visual Examples

Expand Down
2 changes: 1 addition & 1 deletion packages/components/Chip/SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Basic examples:
<Chip icon={{ svgSource: { src: TestSvg, viewBox: '0 0 500 500' } }} disabled />
```

More examples on the [Test pages for the Chip](../../../apps/fluent-tester/src/TestComponents/Chip). Instructions on running the tester app can be found [here](../../../apps/fluent-tester/README.md).
More examples on the [Test pages for the Chip](../../../apps/tester-core/src/TestComponents/Chip). Instructions on running the tester app can be found [here](../../../apps/fluent-tester/README.md).

## Visual Examples

Expand Down
2 changes: 1 addition & 1 deletion packages/components/Icon/SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const svgSrcProps: SvgIconProps = {
<FontIcon {...fontBuiltInProps} />
```

More examples on the [Test pages for the Icon](../../../apps/fluent-tester/src/TestComponents/Icon). Instructions on running the tester app can be found [here](../../../apps/fluent-tester/README.md).
More examples on the [Test pages for the Icon](../../../apps/tester-core/src/TestComponents/Icon). Instructions on running the tester app can be found [here](../../../apps/fluent-tester/README.md).

## Visual Examples

Expand Down
1 change: 1 addition & 0 deletions packages/components/Icon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"dependencies": {
"@fluentui-react-native/adapters": "workspace:*",
"@fluentui-react-native/framework": "workspace:*",
"@fluentui-react-native/framework-base": "workspace:*",
"@fluentui-react-native/text": "workspace:*"
},
"devDependencies": {
Expand Down
Loading
Loading