In the short term, the new Button control is named ButtonV1 while it clashes with the existing older control. Once we deprecate the old control, it will be renamed to Button. It may be useful to rename the control to Button using the import syntax to simplify the rename:
import { ButtonV1 as Button } from '@fluentui-react-native/button'Primary and Stealth buttons now map to Button:
v0 Button |
v1 Button |
|---|---|
<Button content="Hello, world" /> |
<Button>Hello, world</Button> |
<PrimaryButton content="Hello, world" /> |
<Button appearance='primary'>Hello, world</Button> |
<StealthButton content="Hello, world" /> |
<Button appearance='subtle'>Hello, world</Button> |
- Any props that are part of
ViewProps childrencomponentReficononClicktestIDtooltip
content=> Pass the content aschildreninsteadendIcon=> Useaftervalue foriconPositionprop and pass icon information intoiconprop insteadstartIcon=> Usebeforevalue foriconPositionprop and pass icon information intoiconprop instead
- Cannot use both
startIconandendIconat the same time in v1
- Any props that are part of
FontTokens,IForegroundColorTokens,IBackgroundColorTokens,IBorderTokens iconColoriconSizeiconWeight
contentPadding=> Set onstyleproperty ofrootproperty underslotPropsincomposeAPIiconColorHovered=> UseiconColortoken under thehoveredstate tokeniconColorPressed=> UseiconColortoken under thepressedstate token
contentPaddingFocused=> Removed in favor of using native based focus visualswrapperBorderColor=> Removed in favor of using native based focus visuals
borderWrapperhas been removed in favor of using native focus visuals. Userootinstead.stackhas been removed. Userootinstead.
If you are using the older theme provider ThemeProvider from @uifabricshared/theming-react-native, you will need to update the ThemeProvider to pull from @fluentui-react-native/theme to have the control work properly with themes. Please see this page for guidance.
Please see this page for guidance on how to move from the old customize API to the new one.
If you were using PrimaryButton or StealthButton, any color customizations will need to be applied under the primary and subtle tokens, respectively:
const Custom = StealthButton.customize({
tokens: {
borderWidth: 0,
color: 'white',
backgroundColor: 'red',
}
});would become
const Custom = Button.customize({
subtle: {
borderWidth: 0,
color: 'white',
backgroundColor: 'red',
}
});Please see this page for guidance on how to move from the old customize API to the new one.
The FURN button cannot be used in place of a FluentUI button - these buttons are intended to be used on their respective platforms. See this porting guide for general guidance on coming from FluentUI to FURN.
childrendisabledicononClicktestIDtooltip
No Button specific renames.
icontakes in a props object instead of the JSX element itself. This is due to framework differences from FluentUI.iconOnlymust be supplied for components do not have any text content for them to be styled correctly. This is due to framework differences from FluentUI.refis exposed ascomponentRef, similar to previous versions of FluentUI. This is due to framework differences from FluentUI.
appearancedoes not include values fortransparentoroutlineas neither currently are used by native platforms.iconPositionusesbeforeandafteras values instead ofleftandrightfor better right to left support.
v0 Button |
v1 Button |
|---|---|
componentRef |
componentRef |
content |
|
disabled |
disabled |
endIcon |
iconPosition |
icon |
icon |
onClick |
onClick |
statIcon |
iconPosition |
testId |
testId |
tooltip |
tooltip |